package com.ruoyi.receipt.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.receipt.utils.UserInitUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.receipt.mapper.TbExampleSubjectRelationMapper;
import com.ruoyi.receipt.domain.TbExampleSubjectRelation;
import com.ruoyi.receipt.service.ITbExampleSubjectRelationService;

/**
 * 例题-问题答案关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-31
 */
@Service
public class TbExampleSubjectRelationServiceImpl implements ITbExampleSubjectRelationService 
{
    @Autowired
    private TbExampleSubjectRelationMapper tbExampleSubjectRelationMapper;

    /**
     * 查询例题-问题答案关联
     * 
     * @param id 例题-问题答案关联ID
     * @return 例题-问题答案关联
     */
    @Override
    public TbExampleSubjectRelation selectTbExampleSubjectRelationById(Long id)
    {
        return tbExampleSubjectRelationMapper.selectTbExampleSubjectRelationById(id);
    }

    /**
     * 查询例题-问题答案关联列表
     * 
     * @param tbExampleSubjectRelation 例题-问题答案关联
     * @return 例题-问题答案关联
     */
    @Override
    @DataScope(deptAlias = "da",userAlias = "createId")
    public List<TbExampleSubjectRelation> selectTbExampleSubjectRelationList(TbExampleSubjectRelation tbExampleSubjectRelation)
    {
        return tbExampleSubjectRelationMapper.selectTbExampleSubjectRelationList(tbExampleSubjectRelation);
    }

    /**
     * 新增例题-问题答案关联
     * 
     * @param tbExampleSubjectRelation 例题-问题答案关联
     * @return 结果
     */
    @Override

    public int insertTbExampleSubjectRelation(TbExampleSubjectRelation tbExampleSubjectRelation)
    {
        UserInitUtils.initUserInfo(tbExampleSubjectRelation);
        tbExampleSubjectRelation.setCreateTime(DateUtils.getNowDate());
        return tbExampleSubjectRelationMapper.insertTbExampleSubjectRelation(tbExampleSubjectRelation);
    }

    /**
     * 修改例题-问题答案关联
     * 
     * @param tbExampleSubjectRelation 例题-问题答案关联
     * @return 结果
     */
    @Override

    public int updateTbExampleSubjectRelation(TbExampleSubjectRelation tbExampleSubjectRelation)
    {
        UserInitUtils.initUserInfoForUpdate(tbExampleSubjectRelation);
        tbExampleSubjectRelation.setUpdateTime(DateUtils.getNowDate());
        return tbExampleSubjectRelationMapper.updateTbExampleSubjectRelation(tbExampleSubjectRelation);
    }

    /**
     * 批量删除例题-问题答案关联
     * 
     * @param ids 需要删除的例题-问题答案关联ID
     * @return 结果
     */
    @Override
    public int deleteTbExampleSubjectRelationByIds(Long[] ids)
    {
        return tbExampleSubjectRelationMapper.deleteTbExampleSubjectRelationByIds(ids);
    }

    /**
     * 删除例题-问题答案关联信息
     * 
     * @param id 例题-问题答案关联ID
     * @return 结果
     */
    @Override
    public int deleteTbExampleSubjectRelationById(Long id)
    {
        return tbExampleSubjectRelationMapper.deleteTbExampleSubjectRelationById(id);
    }

    @Override
    public List<String> selectTbExampleSubjectRelationMangagerId(Long id) {
        return tbExampleSubjectRelationMapper.selectTbExampleSubjectRelationMangagerId(id);
    }

    @Override
    public int deleteTbExampleSubjectRelationSMId(Long id) {
        return tbExampleSubjectRelationMapper.deleteTbExampleSubjectRelationSMId(id);
    }

    @Override
    public List selectRelation(Long subjectManagerId) {
        return tbExampleSubjectRelationMapper.selectRelation(subjectManagerId);
    }




}
